<?php

use Phinx\Migration\AbstractMigration;

class AddParamColumnInContractTable extends AbstractMigration
{
    public function up()
    {
        $this->table("contract")
            ->addColumn("param", 'json', ['null' => true, 'comment' => '额外参数'])
            ->addColumn("contract_template_id", 'integer', ['null' => false, 'limit' => 11, 'default' => 0, 'comment' => '合同模板id'])
            ->addColumn("fdd_party_a_transaction_id", 'char', ['null' => false, 'limit' => 32, 'default' => "", 'comment' => 'FDD合同甲方交易ID'])
            ->addColumn("fdd_party_b_transaction_id", 'char', ['null' => false, 'limit' => 32, 'default' => "", 'comment' => 'FDD合同乙方交易ID'])
            ->addColumn('status', 'enum', ['default' => 'wait_for_sign', 'value' => "wait_for_sign,signed", 'comment' => '签订状态'])
            ->save();
    }

    public function down()
    {
        $this->table("contract")
            ->removeColumn("param")
            ->removeColumn("contract_template_id")
            ->removeColumn("fdd_party_a_transaction_id")
            ->removeColumn("fdd_party_b_transaction_id")
            ->removeColumn("status")
            ->save();
    }
}
